/* ============ TOKENS ============ */
:root {
  --primary: #0f172a;
  --secondary: #0369a1;
  --accent: #ea580c;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #1e293b;
  --text-soft: #475569;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 4px 12px rgba(0,0,0,0.07);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.10);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', Consolas, 'Fira Code', monospace;
  --sidebar-w: 290px;
  --appbar-h: 56px;
  --bottomnav-h: 62px;
  --content-max: 780px;
}

[data-theme="dark"] {
  --primary: #e2e8f0;
  --secondary: #38bdf8;
  --accent: #fb923c;
  --bg: #0b1220;
  --surface: #111a2e;
  --surface-2: #1a2540;
  --text: #e2e8f0;
  --text-soft: #b6c2d9;
  --muted: #7d8aa5;
  --border: #1f2a44;
  --border-strong: #2b3956;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.35);
  --shadow: 0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.55);
}

/* ============ BASE ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}
@media (min-width: 1024px) { body { font-size: 17px; } }

a { color: var(--secondary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

.skip-link {
  position: absolute; top: -40px; left: 8px;
  background: var(--primary); color: #fff; padding: 8px 14px;
  border-radius: var(--radius-sm); z-index: 999; font-size: 14px;
}
.skip-link:focus { top: 8px; }

:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============ LAYOUT ============ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform .25s ease;
}
.sidebar.is-open { transform: translateX(0); }

.sidebar__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; }
.sidebar__logo { font-size: 26px; }
.sidebar__brand strong { display: block; font-size: 15px; color: var(--text); }
.sidebar__brand small { display: block; font-size: 11px; color: var(--muted); }

.sidebar__theme {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-soft);
  border-radius: 50%; width: 34px; height: 34px;
  display: grid; place-items: center;
}
.sidebar__theme:hover { color: var(--secondary); border-color: var(--secondary); }

.sidebar__progress { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.sidebar__progress-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted);
  margin-bottom: 6px;
}
.progressbar {
  height: 6px; background: var(--surface-2);
  border-radius: 3px; overflow: hidden;
}
.progressbar__fill {
  height: 100%; background: linear-gradient(90deg, var(--secondary), var(--accent));
  width: 0%; transition: width .4s ease;
}

.sidebar__nav {
  flex: 1; overflow-y: auto;
  padding: 12px 10px;
}
.sidebar__footer { padding: 14px 18px; border-top: 1px solid var(--border); }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 90;
}

.main {
  flex: 1;
  width: 100%;
  padding: calc(var(--appbar-h) + 16px) 20px calc(var(--bottomnav-h) + 20px);
  max-width: 100%;
}
.view { max-width: var(--content-max); margin: 0 auto; }

.appbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--appbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  z-index: 80;
}
.appbar__brand { font-weight: 700; color: var(--text); font-size: 15px; }
.appbar__menu, .appbar__theme {
  background: transparent; border: none; color: var(--text-soft);
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
}
.appbar__menu:hover, .appbar__theme:hover { background: var(--surface-2); color: var(--secondary); }

.bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: center;
  z-index: 80;
}
.bottomnav__item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 500;
  text-decoration: none; padding: 6px 10px; border-radius: 8px;
}
.bottomnav__item.is-active, .bottomnav__item:hover {
  color: var(--secondary); text-decoration: none;
}
.bottomnav__item.is-active { background: var(--surface-2); }

/* Desktop: sidebar fija, appbar y bottomnav ocultas */
@media (min-width: 1024px) {
  .sidebar { position: fixed; transform: none; }
  .appbar, .bottomnav { display: none; }
  .main { margin-left: var(--sidebar-w); padding: 32px 40px; }
  .view { max-width: 820px; }
}

/* ============ CASE BANNER ============ */
.case-banner {
  background: linear-gradient(135deg, rgba(234,88,12,.08), rgba(3,105,161,.08));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-soft);
  display: flex; align-items: center; gap: 10px;
  max-width: 820px; margin-left: auto; margin-right: auto;
}
.case-banner strong { color: var(--text); }
.case-banner .pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 1; } 50% { opacity: .4; }
}

/* ============ NAV LINKS (sidebar) ============ */
.nav-group { margin-bottom: 14px; }
.nav-group__title {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 700;
  padding: 0 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--text-soft); font-size: 13px;
  text-decoration: none; line-height: 1.3;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--secondary); text-decoration: none; }
.nav-link.is-active {
  background: var(--surface-2); color: var(--secondary);
  border-left-color: var(--secondary); font-weight: 600;
}
.nav-link__icon { width: 18px; text-align: center; flex-shrink: 0; font-size: 14px; }
.nav-link__check {
  margin-left: auto; color: var(--success); font-size: 12px;
}
.nav-link.is-soon { opacity: .55; }
.nav-link.is-soon::after {
  content: "pronto"; font-size: 9px; margin-left: auto;
  background: var(--surface-2); color: var(--muted);
  padding: 1px 6px; border-radius: 4px; font-weight: 600;
}

/* ============ TIPOGRAFÍA ============ */
h1 {
  font-size: 1.7rem; line-height: 1.25; color: var(--text);
  margin: 0 0 12px; font-weight: 800;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
@media (min-width: 768px) { h1 { font-size: 2.1rem; } }

h2 {
  font-size: 1.25rem; color: var(--text); font-weight: 700;
  margin: 32px 0 12px;
  padding-bottom: 6px; border-bottom: 2px solid var(--border);
}
h3 { font-size: 1.08rem; color: var(--text); font-weight: 700; margin: 22px 0 8px; }
h4 { font-size: .95rem; color: var(--text-soft); font-weight: 700; margin: 16px 0 6px; text-transform: uppercase; letter-spacing: .04em; }

p { margin: 0 0 12px; color: var(--text-soft); }
p.lead { font-size: 1.05rem; color: var(--text); }
strong { color: var(--text); font-weight: 700; }
em { color: var(--text-soft); }
small { color: var(--muted); }

ul, ol { padding-left: 22px; margin: 0 0 14px; color: var(--text-soft); }
li { margin-bottom: 5px; }
li > strong:first-child { color: var(--text); }

code {
  font-family: var(--mono); font-size: .88em;
  background: var(--surface-2); color: var(--accent);
  padding: 2px 6px; border-radius: 4px;
}

blockquote {
  border-left: 4px solid var(--secondary);
  background: var(--surface-2);
  padding: 10px 14px; margin: 14px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft); font-style: italic;
}

/* ============ BREADCRUMB + HEADER DE CAPÍTULO ============ */
.breadcrumb {
  font-size: 12px; color: var(--muted);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.breadcrumb span { color: var(--border-strong); }

.chapter-meta {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px;
}
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  background: var(--surface-2); color: var(--text-soft);
  text-transform: uppercase; letter-spacing: .04em;
}
.badge--level { background: rgba(234,88,12,.12); color: var(--accent); }
.badge--module { background: rgba(3,105,161,.12); color: var(--secondary); }
.badge--soon { background: rgba(100,116,139,.12); color: var(--muted); }

.level-stars { color: var(--accent); letter-spacing: 1px; }

/* ============ TL;DR ============ */
.tldr {
  background: linear-gradient(135deg, rgba(3,105,161,.08), rgba(234,88,12,.06));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 22px;
}
.tldr__title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--secondary); font-weight: 800;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.tldr ul { margin: 0; padding-left: 20px; }
.tldr li { color: var(--text-soft); font-size: 14px; margin-bottom: 4px; }

/* ============ CASO BOX ============ */
.case-box {
  background: linear-gradient(135deg, rgba(250,204,21,.10), rgba(234,88,12,.08));
  border: 1px solid rgba(234,88,12,.25);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 18px 0;
}
.case-box__title {
  font-size: .95rem; font-weight: 800; color: var(--accent);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}

/* ============ PROMPT BLOCK ============ */
.prompt {
  background: #0b1220;
  border-radius: var(--radius);
  margin: 16px 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.prompt__header {
  background: #1e293b;
  padding: 8px 14px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.prompt__tag {
  background: var(--accent); color: #fff;
  padding: 2px 10px; border-radius: 20px;
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em;
}
.prompt__title { color: #94a3b8; font-size: 12px; }
.prompt__copy {
  margin-left: auto;
  background: #334155; color: #e2e8f0;
  border: none; padding: 4px 10px;
  border-radius: 6px; font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.prompt__copy:hover { background: var(--secondary); }
.prompt__copy.is-done { background: var(--success); }
.prompt__body {
  padding: 14px 16px;
  color: #e2e8f0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-x: auto;
}
.prompt__footer {
  padding: 8px 14px;
  background: #1e293b;
  border-top: 1px solid #334155;
  font-size: 11px; color: #94a3b8;
}

/* ============ PROFUNDIZAR ============ */
details.deepen {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 16px 0;
  overflow: hidden;
}
details.deepen > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 16px;
  font-size: 13px; font-weight: 700;
  color: var(--secondary);
  display: flex; align-items: center; gap: 8px;
  user-select: none;
}
details.deepen > summary::-webkit-details-marker { display: none; }
details.deepen > summary::before {
  content: "▸"; transition: transform .2s;
  display: inline-block;
}
details.deepen[open] > summary::before { transform: rotate(90deg); }
details.deepen > summary:hover { background: var(--surface-2); }
details.deepen__content {
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-soft);
}
details.deepen__content p { font-size: 14px; }

/* ============ ALERTAS ============ */
.alert {
  display: flex; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin: 14px 0;
  border-left: 4px solid;
  font-size: 14px;
}
.alert__icon { flex-shrink: 0; font-size: 18px; }
.alert__body { color: var(--text-soft); }
.alert__body strong { color: var(--text); }
.alert--info { background: rgba(2,132,199,.08); border-color: var(--info); }
.alert--warn { background: rgba(217,119,6,.10); border-color: var(--warning); }
.alert--ok { background: rgba(5,150,105,.08); border-color: var(--success); }
.alert--danger { background: rgba(220,38,38,.08); border-color: var(--danger); }

/* ============ TIPS ============ */
.tip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 14px 0;
  box-shadow: var(--shadow-sm);
}
.tip-card__header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; margin-bottom: 8px;
}
.tip-card__id {
  font-size: 11px; font-weight: 800; color: var(--accent);
  text-transform: uppercase; letter-spacing: .05em;
}
.tip-card__title { font-size: 1rem; font-weight: 700; color: var(--text); margin-top: 2px; }
.tip-card__meta {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.tip-card__meta .badge { font-size: 10px; }
.tip-card__section { margin-bottom: 10px; }
.tip-card__section h5 {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 800; margin-bottom: 4px;
}
.tip-card__section p { font-size: 14px; margin: 0; }
.tip-card__section .prompt { margin: 6px 0 0; }
.tip-card__actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ============ BOTONES ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 40px;
  border: 1px solid transparent;
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn--primary { background: var(--secondary); color: #fff; }
.btn--primary:hover { background: #075985; text-decoration: none; }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: #c2410c; text-decoration: none; }
.btn--ghost {
  background: transparent; color: var(--text-soft);
  border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--surface-2); color: var(--secondary); text-decoration: none; }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============ TABLAS ============ */
.table-wrap { overflow-x: auto; margin: 14px 0; border-radius: var(--radius); }
table {
  width: 100%; border-collapse: collapse;
  background: var(--surface);
  font-size: 13.5px;
  box-shadow: var(--shadow-sm);
}
th {
  background: var(--primary); color: #fff;
  padding: 9px 12px; text-align: left;
  font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text-soft); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

@media (max-width: 640px) {
  table { font-size: 12px; }
  th, td { padding: 7px 9px; }
}

/* ============ STEPS ============ */
.steps { list-style: none; padding: 0; margin: 16px 0; counter-reset: step; }
.steps li {
  position: relative; padding: 0 0 16px 44px; counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--secondary); color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
}
.steps li::after {
  content: ""; position: absolute; left: 15px; top: 34px; bottom: 0;
  width: 2px; background: var(--border);
}
.steps li:last-child::after { display: none; }
.steps li strong { color: var(--text); }

/* ============ PROMPT COMPARE ============ */
.compare { display: grid; gap: 12px; margin: 16px 0; }
@media (min-width: 768px) { .compare { grid-template-columns: 1fr 1fr; } }
.compare__item { position: relative; }
.compare__label {
  display: inline-block; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 8px; border-radius: 4px; margin-bottom: 4px;
}
.compare__item--bad .compare__label { background: rgba(220,38,38,.15); color: var(--danger); }
.compare__item--good .compare__label { background: rgba(5,150,105,.15); color: var(--success); }

/* ============ EJERCICIO ============ */
.exercise {
  background: linear-gradient(135deg, rgba(3,105,161,.08), rgba(56,189,248,.06));
  border: 1px solid var(--secondary);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 18px 0;
}
.exercise__header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.exercise__title { font-size: 1rem; font-weight: 800; color: var(--secondary); }
.exercise__meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.exercise p { color: var(--text-soft); }
.exercise ol, .exercise ul { font-size: 14px; }
.exercise__actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ HINT ============ */
.hint-btn {
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  color: var(--text-soft); padding: 6px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.hint-btn:hover { color: var(--accent); border-color: var(--accent); }
.hint-content {
  margin-top: 8px; padding: 8px 12px;
  background: rgba(234,88,12,.06); border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0; font-size: 13px; color: var(--text-soft);
  display: none;
}
.hint-content.is-open { display: block; }

/* ============ QUIZ ============ */
.quiz { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 16px 0; }
.quiz__title { font-size: 1rem; font-weight: 800; margin-bottom: 12px; color: var(--text); }
.quiz__q { margin-bottom: 14px; }
.quiz__q-text { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.quiz__options { display: flex; flex-direction: column; gap: 5px; }
.quiz__option {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 13px; color: var(--text-soft); cursor: pointer;
  transition: all .15s;
}
.quiz__option:hover { border-color: var(--secondary); }
.quiz__option input { margin-top: 3px; accent-color: var(--secondary); }
.quiz__option.is-correct { background: rgba(5,150,105,.12); border-color: var(--success); color: var(--success); }
.quiz__option.is-wrong { background: rgba(220,38,38,.10); border-color: var(--danger); color: var(--danger); }
.quiz__feedback { margin-top: 8px; font-size: 13px; color: var(--text-soft); display: none; }
.quiz__feedback.is-open { display: block; }

/* ============ NAVEGACIÓN CAPÍTULOS ============ */
.chapter-nav {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 32px; padding-top: 20px;
  border-top: 2px solid var(--border);
  flex-wrap: wrap;
}
.chapter-nav .btn { flex: 1; min-width: 140px; justify-content: center; }
.chapter-nav .btn:only-child { flex: 0 0 auto; }
@media (max-width: 480px) {
  .chapter-nav { flex-direction: column; }
  .chapter-nav .btn { width: 100%; flex: none; }
}

/* ============ HOME ============ */
.hero {
  background: linear-gradient(135deg, var(--primary), #1e3a5f);
  color: #fff; border-radius: var(--radius);
  padding: 32px 24px; margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.hero::before {
  content: "🥭"; position: absolute; right: -10px; bottom: -20px;
  font-size: 140px; opacity: .12; transform: rotate(-15deg);
}
.hero h1 { color: #fff; margin-bottom: 10px; font-size: 1.5rem; }
@media (min-width: 768px) { .hero h1 { font-size: 2rem; } }
.hero p { color: #cbd5e1; font-size: 1rem; max-width: 620px; margin-bottom: 18px; }
.hero__actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .btn--accent { background: var(--accent); }
.hero .btn--ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.hero .btn--ghost:hover { background: rgba(255,255,255,.1); color: #fff; }

.section-title {
  font-size: 1.2rem; font-weight: 800;
  margin: 28px 0 14px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}

.card-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .card-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: 1fr 1fr 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 8px;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--secondary);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.card__icon { font-size: 26px; }
.card__title { font-size: 15px; font-weight: 700; color: var(--text); }
.card__desc { font-size: 13px; color: var(--muted); flex: 1; }
.card__meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.card.is-soon { opacity: .7; cursor: not-allowed; }
.card.is-soon:hover { transform: none; border-color: var(--border); box-shadow: none; }

/* ============ ECOSISTEMA / HERRAMIENTAS ============ */
.tool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin: 10px 0;
  display: flex; gap: 12px; align-items: flex-start;
}
.tool-card--op { border-left: 4px solid var(--success); }
.tool-card--support { border-left: 4px solid var(--warning); }
.tool-card--ref { border-left: 4px solid var(--muted); opacity: .92; }
.tool-card__icon { font-size: 26px; flex-shrink: 0; }
.tool-card__body { flex: 1; }
.tool-card__name { font-size: 15px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tool-card__tag { font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .04em; }
.tool-card__tag--op { background: rgba(5,150,105,.15); color: var(--success); }
.tool-card__tag--support { background: rgba(217,119,6,.15); color: var(--warning); }
.tool-card__tag--ref { background: var(--surface-2); color: var(--muted); }
.tool-card__use { font-size: 13px; color: var(--text-soft); margin-top: 4px; }
.tool-card__meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px; margin-top: 8px; font-size: 12px;
}
.tool-card__meta div strong { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 1px; }

/* ============ PROGRESO ============ */
.progress-grid { display: grid; gap: 12px; margin: 16px 0; }
@media (min-width: 640px) { .progress-grid { grid-template-columns: 1fr 1fr; } }
.progress-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.progress-card__title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.progress-card__bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.progress-card__fill { height: 100%; background: linear-gradient(90deg, var(--secondary), var(--accent)); transition: width .4s; }
.progress-card__label { font-size: 12px; color: var(--muted); }

/* ============ FOOTER ============ */
.footer {
  margin-top: 48px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted); text-align: center;
}

/* ============ BACKDROP SIDEBAR MOBILE ============ */
.sidebar-backdrop.is-open { display: block; }

/* ============ PRINT ============ */
@media print {
  .sidebar, .appbar, .bottomnav, .sidebar-backdrop,
  .chapter-nav, .btn, .tip-card__actions,
  .prompt__copy, .case-banner, .footer { display: none !important; }
  .main { margin-left: 0 !important; padding: 0 !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  details.deepen { display: block; }
  details.deepen > summary { display: none; }
  details.deepen__content { display: block !important; }
  .prompt__body { background: #f1f5f9 !important; color: #0f172a !important; }
  .prompt { box-shadow: none; border: 1px solid #cbd5e1; }
  .prompt__header, .prompt__footer { background: #e2e8f0 !important; color: #0f172a !important; }
  a { color: #000; text-decoration: underline; }
  h1, h2, h3 { page-break-after: avoid; }
  table, .prompt, .case-box, .exercise { page-break-inside: avoid; }
}
/* ============ LAB (E5) ============ */
.lab-form {
  display: grid;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}
.lab-field { display: flex; flex-direction: column; gap: 4px; }
.lab-field__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 800;
}
.lab-field__input, .lab-field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
.lab-field__input:focus, .lab-field select:focus {
  outline: none; border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(3,105,161,.15);
}
.lab-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.lab-output { margin-top: 16px; }
.lab-manual { margin-top: 32px; padding-top: 24px; border-top: 2px solid var(--border); }
.lab-manual h3 { margin-bottom: 12px; }

/* Comparador */
.cmp-variant {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-2);
}
.cmp-variant__title {
  font-size: 12px; font-weight: 800; color: var(--secondary);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px;
}
.cmp-rubric {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px;
}
.cmp-rubric label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-soft);
}
.cmp-rubric input[type=range] { flex: 1; accent-color: var(--secondary); }
.cmp-rubric span {
  min-width: 20px; text-align: center; font-weight: 700; color: var(--secondary);
}
@media (max-width: 640px) { .cmp-rubric { grid-template-columns: 1fr; } }

/* Auditor FOR */
.aud-phase {
  border-left: 4px solid var(--secondary);
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 8px;
}
.aud-phase--warn { border-color: var(--warning); }
.aud-phase--ok { border-color: var(--success); }
.aud-phase__title {
  font-size: 13px; font-weight: 700; color: var(--text);
  margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.aud-phase__num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--secondary); color: #fff;
  display: inline-grid; place-items: center; font-size: 12px;
}

/* Verificador */
.checklist {
  display: grid; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin: 12px 0;
}
.checklist__item {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 14px; color: var(--text-soft); cursor: pointer;
}
.checklist__item input { margin-top: 4px; accent-color: var(--secondary); }

.alucinacion-game {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin: 16px 0;
}
.alucinacion-game__text {
  font-size: 15px; line-height: 1.8;
  background: var(--surface-2); border-radius: 8px;
  padding: 12px 14px; margin: 12px 0;
}
.alucinacion-game__span {
  cursor: pointer; padding: 2px 4px; border-radius: 4px;
  border-bottom: 2px dashed var(--border-strong);
  transition: background .15s;
}
.alucinacion-game__span:hover { background: rgba(234,88,12,.08); }
.alucinacion-game__span.is-marked {
  background: rgba(220,38,38,.15);
  border-bottom-color: var(--danger);
  color: var(--danger); font-weight: 600;
}

/* Selector */
.selector-result {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: var(--radius); padding: 18px; margin: 16px 0;
}
.selector-result__tool {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; margin-bottom: 12px;
}
.selector-result__icon { font-size: 28px; }
.selector-result__row {
  font-size: 14px; color: var(--text-soft);
  margin-bottom: 8px; line-height: 1.5;
}
.selector-result__row strong { color: var(--text); }

/* Chart blocks (M4.5) */
.chart-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin: 16px 0;
}
.chart-block__header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.chart-block__title { font-weight: 700; color: var(--text); font-size: 15px; }
.chart-block__container {
  min-height: 340px;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print: expandir detalles al imprimir */
@media print {
  details.deepen { display: block; }
  details.deepen > summary { display: none; }
  details.deepen > .deepen__content { display: block !important; }
  .chart-block__container { min-height: 200px; }
  .chart-block__header .btn { display: none; }
}
/* Crédito del curso (home) */
.hero__credit {
  font-size: 12px;
  color: rgba(203,213,225,.85);
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.15);
  position: relative;
  z-index: 1;
}
.hero__credit strong {
  color: #fb923c;
}
.hero__credit a {
  color: #fb923c;
  text-decoration: underline;
}
.hero__credit a:hover {
  color: #fdba74;
}